package com.cfs.svcimpl.sys;

import java.util.List;

import com.cfs.dao.sys.MenuDao;
import com.cfs.svc.sys.MenuService;
import com.cfs.po.sys.Menu;
import com.cfs.po.sys.Right;

/**
 *	菜单管理服务实现
 *
 *	@author ZJ
 * 	@since 2014-02-17
 *	@version 1.0
 */
public class MenuServiceImpl implements MenuService {
	
	private MenuDao dao;
	
	public void setDao(MenuDao dao){
		this.dao = dao;
	}

	@Override
	public Menu add(Menu menu) {
		return dao.add(menu);
	}

	@Override
	public Menu update(Menu menu) {
		return dao.updateMenu(menu);
	}

	@Override
	public int delete(Long menuid) {
		return dao.deleteById(new Long[]{menuid});
	}

	@Override
	public Menu get(Long id) {
		return dao.queryById(id);
	}

	@Override
	public List<Menu> getByRole(Long rid) {
		return dao.queryByRoleId(rid);
	}

	@Override
	public int updateRoleMenu(Long rid, Long[] mids) {
		return dao.updateRoleMenus(rid, mids);
	}

	@Override
	public List<Right> getMenuRightList(Long mid) {
		// TODO Auto-generated method stub
		return dao.queryRightsById(mid);
	}



}
